package com.android.studyspot;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class StudySpotView extends LinearLayout {
	private StudySpot m_studySpot;
	
	private TextView m_ssCourse;
	private TextView m_ssTime;
	private TextView m_ssDate;
	
	public StudySpotView(Context context, StudySpot ss){
		super(context);
				
		Log.d("study-spot", "StudySpotView()");
		
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.studyspot_view, this, true);
		
		m_ssCourse = (TextView) findViewById(R.id.ss_course);
		m_ssTime = (TextView) findViewById(R.id.ss_time);
		m_ssDate = (TextView) findViewById(R.id.ss_date);
		
		setStudySpot(ss);	
	}
	
	public void setStudySpot(StudySpot ss){
		
		Log.d("study-spot", "setStudySpot()");
		
		this.m_studySpot = ss;
		
		this.m_ssCourse.setText(this.m_studySpot.getCourse());		
		this.m_ssTime.setText(this.m_studySpot.getStartEndTime());
		this.m_ssDate.setText(this.m_studySpot.getDate());

		requestLayout();
	}
	
	public StudySpot getStudySpot(){
		return this.m_studySpot;
	}
}
